import 'package:flutter/material.dart';
import 'package:read_book/ui/pages/book_city/book_city_ranking.dart';

class BookCity extends StatelessWidget {
  //tabs
  String tabsName = 'ranking';

  BookCity({Key key, this.tabsName}) : super(key: key);

  void initState() {}

  @override
  Widget build(BuildContext context) {
    return DefaultTabController(
        length: 4,
        child: Scaffold(
          appBar: AppBar(
            leading: IconButton(
              icon: const Icon(Icons.search),
              onPressed: () {
                Navigator.pushNamed(context, '/search');
              },
              color: Colors.black54,
            ),
            actions: <Widget>[
              IconButton(
                icon: const Icon(Icons.widgets),
                onPressed: () {
                  Navigator.pushNamed(context, '/classify');
                },
                color: Colors.black54,
              )
            ],
            backgroundColor: Colors.grey[50],
            title: const Center(
              child: Text(
                '二蛋阅读',
                style: TextStyle(color: Colors.black87),
              ),
            ),
            bottom: const TabBar(
              isScrollable: true,
              labelColor: Colors.black87,
              unselectedLabelColor: Colors.black45,
              indicatorColor: Colors.orange,
              indicatorSize: TabBarIndicatorSize.tab,
              indicatorWeight: 2.0,
              //是否可以滚动
              tabs: <Widget>[
                Tab(
                  child: Center(child: Text('排行榜')),
                ),
                Tab(
                  child: Center(child: Text('男生')),
                ),
                Tab(
                  child: Center(child: Text('女生')),
                ),
                Tab(
                  child: Center(child: Text('出版')),
                )
              ],
            ),
          ),
          body: const Center(
            child: TabBarView(
              children: <Widget>[
                Ranking(tabsName: 'ranking'),
                Ranking(tabsName: 'man'),
                Ranking(tabsName: 'woman'),
                Ranking(tabsName: 'publish')
              ],
            ),
          ),
        ));
  }
}
